// 系统管理员/省级管理员策略（角色1、2）
package com.zhang.bingmei_incomeexpenditure.service.strategy.Impl;

import com.zhang.bingmei_incomeexpenditure.entity.commom.DataScope;
import com.zhang.bingmei_incomeexpenditure.service.strategy.DataScopeStrategy;
import org.apache.commons.lang3.StringUtils;

import java.util.List;
import java.util.stream.Collectors;

public class AdminProvinceDataScopeStrategy implements DataScopeStrategy {
    @Override
    public DataScope getAreaPrefix() {
        DataScope dataScope = new DataScope();
        dataScope.setArea("460000"); // 海南省前缀
        dataScope.setMinLevel(1);
        return dataScope;
    }

    @Override
    public List<String> buildFullDistrictCodes(List<String> districtSuffixList) {
        String prefix = getAreaPrefix().getArea();
        return districtSuffixList.stream()
                .filter(StringUtils::isNotBlank)
                .map(suffix -> prefix + "," + suffix)
                .collect(Collectors.toList());
    }

    @Override
    public int supportRoleLevel() {
        return 1; // 支持角色1（系统管理员）、2（省级管理员）
    }
}

